package com.zy.web.demo.duoxiancheng.demo32;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/9/9 15:19
 */
public class Service32B {

    private ReentrantLock lock = new ReentrantLock();

    public void test(){
        if (lock.tryLock()){
            System.out.println(Thread.currentThread().getName()+"获得锁");
        }else {
            System.out.println(Thread.currentThread().getName()+"未得锁");
        }
    }

}
